<?php

require_once "dbconnect.php";

$username = $_POST['username'];
if( empty($username) ) $username = $_GET['username'];

$password = $_POST['password'];
if( empty($password) ) $password = $_GET['password'];



$sql = "SELECT * FROM user WHERE username='".$username."' AND password='".md5($password)."' AND status='1'";
$res = $db->query($sql) or $return = array("status"=>"error");
if( $res->num_rows > 0 ){
	$return = array("status"=>"ok", "user"=>array("username"=>$res->row["username"]));
} else {
	$return = array("status"=>"error");
}
echo json_encode($return);

?>
